package com.data.utill;

import java.util.*;

/**
 * 取出数据用于前台选项
 * Created by cxj on 2017/6/27.
 */
public class CommonOption {

    public static List<TableField> getStateOption() {
        return getOption("state");
    }

    public static List<TableField> getCdtrclassOption() {
        return getOption("cdtrclass");
    }
    public static List<TableField> getorgAccountStateOption() {
        return getOption("orgAccountState");
    }
    public static List<TableField> getBookmodeOption() {
        return getOption("bookmode");
    }
    public static List<TableField> getOrgtypeOption() {
        return getOption("orgtype");
    }
    public static List<TableField> getBusiallowOption() {
        return getOption("busiallow");
    }
    public static List<TableField> getConsigntypeOption() {
        return getOption("consigntype");
    }
    public static List<TableField> getCheckflagOption() {
        return getOption("checkflag");
    }
    public static List<TableField> getMactypeOption() {
        return getOption("mactype");
    }
    public static List<TableField> getNodetypeOption() {
        return getOption("nodetype");
    }
    public static List<TableField> getSvctypeOption() {return getOption("svctype");}
    public static List<TableField> getCommtypeOption() {
        return getOption("commtype");
    }
    public static List<TableField> getOrgstatOption() {
        return getOption("orgstat");
    }
    public static List<TableField> getDownmodeOption() {
        return getOption("downmode");
    }
    public static List<TableField> getBanklevelOption() {
        return getOption("banklevel");
    }
    public static List<TableField> getBankstatOption() {
        return getOption("bankstat");
    }
    public static List<TableField> getDcflagOption() {
        return getOption("dcflag");
    }






    private static List<TableField> getOption(String type) {
        return getOption(type, new String[] {});
    }
    // 剔除指定keys所包含的元素
    private static List<TableField> getOption(String type, String[] keys) {
        LinkedHashMap<String, String> map = new TableField(type).getHashMap();
        List<String> keyList = Arrays.asList(keys);
        List<TableField> list = new ArrayList<TableField>();
        TableField tableField;
        for (Map.Entry<String, String> entry : map.entrySet()) {
            if (keyList.indexOf(entry.getKey()) == -1) {
                tableField = new TableField(entry.getKey(), entry.getValue());
                list.add(tableField);
            }
        }
        return list;
    }

}
